﻿using JNPF.Basics.Models;
using JNPF.Utils;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace JNPF.Basics.Logic
{
    /// <summary>
    /// 流程传阅
    /// 版 本：V3.0.0
    /// 版 权：引迈信息技术有限公司（https://www.jnpfsoft.com）
    /// 作 者：JNPF开发平台组
    /// 日 期：2018-07-17 
    /// </summary>
    public class FlowTaskCirculateBll
    {
        private FlowTaskCirculateIService service = new FlowTaskCirculateService();

        /// <summary>
        /// 删除（根据实例Id）
        /// </summary>
        /// <param name="taskId">任务主键</param>
        /// <returns></returns>
        public async Task<int> DeleteByTaskId(string taskId)
        {
            try
            {
                return await service.DeleteByTaskId(taskId);
            }
            catch (Exception ex)
            {
                throw ExceptionEx.Throw(ex);
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="nodeId">节点主键</param>
        /// <returns></returns>
        public async Task<int> DeleteByNodeId(string nodeId)
        {
            try
            {
                return await service.DeleteByNodeId(nodeId);
            }
            catch (Exception ex)
            {
                throw ExceptionEx.Throw(ex);
            }
        }
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="entitys">实体对象</param>
        /// <returns></returns>
        public async Task<int> Create(List<FlowTaskCirculateEntity> entitys)
        {
            try
            {
                return await service.Create(entitys);
            }
            catch (Exception ex)
            {
                throw ExceptionEx.Throw(ex);
            }
        }
    }
}